
//Copyright 1997-2009 Syrinx Development, Inc.
//This file is part of the Syrinx Web Application Framework (SWAF).
// == BEGIN LICENSE ==
//
// Licensed under the terms of any of the following licenses at your
// choice:
//
//  - GNU General Public License Version 3 or later (the "GPL")
//    http://www.gnu.org/licenses/gpl.html
//
//  - GNU Lesser General Public License Version 3 or later (the "LGPL")
//    http://www.gnu.org/licenses/lgpl.html
//
//  - Mozilla Public License Version 1.1 or later (the "MPL")
//    http://www.mozilla.org/MPL/MPL-1.1.html
//
// == END LICENSE ==
using System;
using System.Collections;
using System.Data;
using System.Diagnostics;
using System.Text.RegularExpressions;
using System.Xml;


using Swaf.Config;
using Swaf.Container;

namespace Swaf.Messaging
{

	/// <summary>
	/// Summary description for ConnectionFactoryContainerNode.
	/// </summary>
	public class ConnectionFactoryContainerNode : INameAddressSupport, ICatalogItem
	{
		protected string m_catalogName;
		protected QueueConnectionInfo m_connection; 

		public ConnectionFactoryContainerNode(Match mr, object extraInfo)
		{
			if(extraInfo != null && extraInfo is XmlElement)
			{
				XmlElement el = (XmlElement)extraInfo;
				m_connection = new QueueConnectionInfo(el);
			}
		}

		public ConnectionFactoryContainerNode(XmlElement el, string catalogName)
		{
			m_catalogName =catalogName;
			m_connection = new QueueConnectionInfo(el);
		}


		#region INameAddressSupport Members

		public void put(string nameAddress, object val)
		{
		}

		public void put(string nameAddress, object val, object extraInfo)
		{
		}

		public object get(string nameAddress, object oneArg)
		{
			return m_connection;
		}

		public object get(string nameAddress)
		{
			return m_connection;
		}

		public object get(string nameAddress, params object[] infoArgs)
		{
			return m_connection;
		}

		public bool isGetOnly {	get{return false;}}

		public XmlSerializationSupport SerializationSupport {get{return XmlSerializationSupport.None;}}

		public string Xml {get{return null;}}

		public string getXml(string options) {return null;}

		public bool containsField(String nameAddress) {return false;}

		#endregion
		#region ICatalogItem Members
		protected string m_expiration=null;
		protected string m_key=null;
		protected string m_searchPath=null;

		public string catalogName
		{
			get
			{
				return m_catalogName;
			}
			set
			{
				m_catalogName=value;
			}
		}

		public string expiration
		{
			get
			{
				return m_expiration;
			}
			set
			{
				m_expiration=value;
			}
		}

		public string key
		{
			get
			{
				return m_key;
			}
			set
			{
				m_key=value;
			}
		}

		public string searchPath
		{
			get
			{
				return m_searchPath;
			}
			set
			{
				m_searchPath=value;
			}
		}

		public bool isCacheable
		{
			get { return true; }
		}

		#endregion
		public IEnumerator GetEnumerator() { return null; }
	}
}
